<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浏览历史</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .history-container {
            max-width: 1200px;
            margin: 30px auto;
            padding: 20px;
        }
        .history-item {
            display: flex;
            padding: 15px;
            margin-bottom: 15px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            transition: all 0.3s;
        }
        .history-item:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        .history-img {
            width: 120px;
            height: 120px;
            object-fit: cover;
            border-radius: 6px;
            margin-right: 20px;
        }
        .history-info {
            flex: 1;
        }
        .history-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 8px;
            color: #333;
        }
        .history-author {
            color: #666;
            margin-bottom: 8px;
        }
        .history-time {
            color: #999;
            font-size: 14px;
        }
        .empty-history {
            text-align: center;
            padding: 50px;
            color: #999;
        }
    </style>
</head>
<body>
<div class="history-container">
    <h2 class="mb-4">浏览历史</h2>

    <c:choose>
        <c:when test="${not empty histories}">
            <div class="history-list">
                <c:forEach items="${histories}" var="histories">
                    <div class="history-item">
                        <img src="${histories.img}" alt="${histories.gname}" class="history-img">
                        <div class="history-info">
                            <h3 class="history-title">${histories.gname}</h3>
                            <p class="history-author">作者：${histories.author}</p>
                            <p class="history-time">
                            <p class="history-time">浏览时间：${histories.historytime}</p>
                        </div>
                    </div>
                </c:forEach>
            </div>
        </c:when>
        <c:otherwise>
            <div class="empty-history">
                <i class="fas fa-history fa-3x mb-3"></i>
                <p>暂无浏览历史</p>
            </div>
        </c:otherwise>
    </c:choose>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
</body>
</html>